package what.basic.textcomponent;
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
public class Jtextarea implements ActionListener {
	JTextArea texta=null;
	JButton b1,b2,b3;
	public Jtextarea(){
		JFrame f=new JFrame("text area test");
		Container cp=f.getContentPane();
		texta=new JTextArea(10,15);
		cp.setLayout(new BorderLayout());
		JScrollPane sp=new JScrollPane(texta);
		texta.setLineWrap(true);
		JPanel jp=new JPanel();
		jp.setLayout(new GridLayout(1,3));
		b1=new JButton("copy");
		b1.addActionListener(this);
		b2=new JButton("paste");
		b2.addActionListener(this);
		b3=new JButton("cut");
		b3.addActionListener(this);
		jp.add(b1);
		jp.add(b2);
		jp.add(b3);
		cp.add(sp,BorderLayout.CENTER);
		cp.add(jp,BorderLayout.SOUTH);
		f.pack();
		f.setVisible(true);
		f.addWindowListener(new WindowAdapter(){
			public void windowClosing(WindowEvent e){
				System.exit(0);
			}
		});
	}
	public static void main(String[] args) {
		new Jtextarea();

	}
	public void actionPerformed(ActionEvent e){
		if(e.getSource()==b1)
			texta.copy();
		if(e.getSource()==b2)
			texta.paste();
		if(e.getSource()==b3)
			texta.cut();
	}

}
